package com.ti.winona.ui.fragment;

import com.taplinker.client.App;
import com.taplinker.client.R;
import com.ti.winona.util.FragmentOperateUtil;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class PerToolFragment extends Fragment {
	
	public static final String TAG = "PerToolFragment";
	
	private View mPerToolView;
	
	private ImageView mImgPerToolBack;
	
	private View mLinCustomerView;
	private View mLinFlightView;
	private View mLinWeatherView;
	private View mLinSkinView;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return mPerToolView = inflater.inflate(R.layout.fragment_pertool, container, false);
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		
		findView();
		initListener();
	}

	private void findView() {
		mImgPerToolBack = (ImageView) mPerToolView.findViewById(R.id.img_pertool_back);
		
		mLinCustomerView = mPerToolView.findViewById(R.id.lin_tool_import_news);
		mLinFlightView = mPerToolView.findViewById(R.id.lin_tool_flight);
		mLinWeatherView = mPerToolView.findViewById(R.id.lin_tool_weather);
		mLinSkinView = mPerToolView.findViewById(R.id.lin_tool_skin);
	}
	
	private void initListener() {
		// 返回监听
		mImgPerToolBack.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				FragmentOperateUtil.popFragmentBackStack(getActivity().getSupportFragmentManager());
			}
		});
		// 重要消息监听
		mLinCustomerView.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				App.showToast("重要消息");
			}
		});
		// 航班查询监听
		mLinFlightView.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				App.showToast("航班查询");
			}
		});
		// 天气预报监听
		mLinWeatherView.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				App.showToast("航班查询");
			}
		});
		// 肌肤测试监听
		mLinSkinView.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				App.showToast("肌肤测试");
			}
		});
	}
	
}
